package test2.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import fun.stgoder.bmwf.core.exception.BaseException;
import org.springframework.stereotype.Service;
import test2.domain.Test2;
import test2.mapper.Test2Mapper;

import javax.annotation.Resource;
import java.util.List;

@Service
public class Test2Service {
    @Resource
    Test2Mapper test1Mapper;

    public List<Test2> f1(String p) {
        Test2 test2 = new Test2();
        String str = String.valueOf(System.currentTimeMillis());
        test2.setId(str);
        test2.setName("name-" + str);
        test1Mapper.insert(test2);
        if ("2".equalsIgnoreCase(p))
            throw new BaseException(-1, "test2 Transcational");
        return test1Mapper.selectList(new QueryWrapper<>());
    }
}
